<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta id="viewport" name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,user-scalable=no,target-densitydpi=300">
<title>智能云管家-登录</title>
<script type="text/javascript" src="resources/js/jquery-1.7.2.min.js"></script>
<script src="bi/res/common.js"></script>
<script src="resources/js/cordova-2.1.0.js"></script>

<script src="resources/js/phonegap_login.js"></script>

<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F883c1dc0c5cf74748ff6876f4606832f' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript">
$(function(){
    addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); 
      function hideURLbar(){ 
               window.scrollTo(0,1); 
      }
      if(navigator.userAgent.toLowerCase().indexOf("android", 0)<0){
         $("#footer").css({"center;z-index":"999","position":"fixed","bottom":"0"});
         window.scrollTo(0,1); 
        }else{
        $("#footer").css({"position":"fixed","bottom":"0"});
    var top = $("#footer").offset().top;
    if(localStr.indexOf("file:///",0)<0)
	{
	    $(window).scroll(function(){
	    $("#footer").offset({top:$(document).scrollTop()+top});
	    });
	}
        }

       });

var localStr=window.location.href;

var israndom="no",phone="",key="",porflag=false,biflag=false;
function loaded() {
	
}

document.addEventListener('DOMContentLoaded', loaded, false);
document.addEventListener("deviceready", onDeviceReady, false);


$(document).ready(function(e) {

	if(detectDeviceType()=="Apple"){
		$("#viewport").attr("content","width=640,initial-scale=0.5, maximum-scale=0.5, minimum-scale=0.5,user-scalable=no");
		
	}
	$("#phoneNo").bind("focus",function(){
	//alert($("#phoneNo").offset().top);
	//window.setTimeout(function(){window.scrollTo(0,$("#phoneNo").offset().top-100);},1000);
	window.setTimeout(function(){window.scrollTo(0,410);},300);
});

	$("#loading").hide();
	$(".floatBoxBg").hide();
	if(localStr.indexOf("file:///",0)>=0)
	{
		$("body").bind("load",function(){
			init();
		});
	}
	var useragent=navigator.userAgent;
	if(detectDeviceType()=="Apple"){
		$("#phoneNo").get(0).style.width="56%";
		$("#password").get(0).style.width="56%";
		$("#phoneNo").get(0).style.height="50px";
		$("#password").get(0).style.height="50px";
		
	}
	
	var w=window.screen.width;
	var h=window.screen.height;
	if(h/w>1.6){
		$("#blank1").get(0).style.height="114px";
	}else{
		$("#blank1").get(0).style.height="114px";
	}
	if(useragent.indexOf("Android 4")>0)
	{
		//$("meta").attr("content","width="+w/0.78+", initial-scale=0.5, minimum-scale=0.5, maximum-scale=0.5");
	}
	$("#content").get(0).style.height=h;
   
    
   	var por_phone=getQueryParameter("phonenum");
	var por_key=getQueryParameter("userkey");
	var bi_key=localStorage.getItem("userkey");
	var bi_phone=localStorage.getItem("curphone");
	if(""!=por_phone && ""!=por_key)
	{
		//alert("phonenum:"+por_phone+",userkey:"+por_key);
		phone=por_phone;
		key=por_key;
		porflag=true;
	}
	if(null!=bi_key && null!=bi_phone)
	{
		phone=bi_phone;
		key=bi_key;
		
		biflag=true;
	}

	if(porflag || biflag)
	{
		var jsonurl=jsonserver+"bl/autoLogin/"+phone+"/"+key;
		$.getJSON(jsonurl+".jsonp?callback=?",{},function(data){
			
			if(data.sb.status=="00000")
			{
				localStorage.setItem("userkey",key);
				localStorage.setItem("curphone",phone);
				localStorage.setItem("username",data.userName);
				localStorage.setItem("innetTime",data.inNetTime);
				localStorage.setItem("payType",data.payType);//0后付费
				localStorage.setItem("credit",data.credit);
				localStorage.setItem("packname",data.packageName);
				localStorage.setItem("datasDate",data.acctDay);
				window.location.href="bi/index.html";
			}else if(data.sb.status=="00002"){
				localStorage.setItem("userkey",key);
				localStorage.setItem("curphone",phoneNumber);
				window.location.href="bi/prodata.html";
			}else
			{
				localStorage.clear();
				window.location.href="bilogin.html";
			}
		});
	}

	//TODO透传登陆需要补充,暂时跳过
	
	
	
});
		

//登陆
function login1()
{

	
	var phoneNumber=$("#phoneNo").val();
	if(!phoneNumber.match("^1(3[0-2]|5[56]|8[56])\\d{8}$")){
		$("#warning").text("输入手机号码不正确!");
		
		$("#phoneNo").focus();
		return false;
	}
	var password = $("#password").val();
	if($("#password").val().length == 0){
		$("#warning").text("密码不能为空");
		
		$("#password").focus();
		return  false;
	}


	var checkurl=jsonserver+"bl/"+phoneNumber+"/"+password+"/yes";
	
	$.getJSON(checkurl+".jsonp?callback=?",{}, function(data) {
			if(data.sb.status=="00000"){
				localStorage.setItem("userkey",data.userkey);
				localStorage.setItem("curphone",phoneNumber);
				localStorage.setItem("username",data.userName);
				localStorage.setItem("innetTime",data.inNetTime);
				localStorage.setItem("payType",data.payType);//0后付费
				localStorage.setItem("credit",data.credit);
				localStorage.setItem("packname",data.packageName);
				localStorage.setItem("datasDate",data.acctDay);
				if(!window.localStorage.getItem(window.localStorage.getItem("curphone"))){
					window.localStorage.setItem(window.localStorage.getItem("curphone"),"1");
				}else{
					window.localStorage.setItem(window.localStorage.getItem("curphone"),"n");
				}
				if(localStr.indexOf("file:///",0)>=0){
					onDeviceReady();
				}
				setTimeout(function(){
					if(getQueryParameter("from")=="activity"){
						window.location.href='bi/activity.html';
					}else{
						window.location.href="bi/index.html";
					}
				},500);
			}else if(data.sb.status=="00002"){
				localStorage.setItem("curphone",phoneNumber);
				localStorage.setItem("userkey",data.userkey);
				window.location.href="bi/prodata.html";	
			}else{
				$("#warning").text(data.sb.statusDesc);
				return false;
			}
	});
}

function loginshow()
{
		var offset = $("#finalDot").offset();
		var loadleft=offset.left;
		var loadtop=offset.top;
		var loadimg=$("<img>").attr("src","resources/css/images/loading.gif").css({
				"position":"absolute",
				"left":loadleft+"px",
				"top":loadtop+"px",
				"z-index":"9999"
			});
			$("body").append(loadimg);
			//loadimg.appendTo($("body"));
		$("body").append('<div class="floatBoxBg"></div>');
}
//获取随机密码
function getpasscode(){
	var reSendTime=40;
	
	var objlogin_name =  $("#phoneNo").val();
	 if(!objlogin_name.match("^1(3[0-2]|5[56]|8[56])\\d{8}$")){
		$("#warning").text("输入手机号码不正确!");
		$("#phoneNo").focus();
		return false;
	}
	 else
	{
		$("#warning").text("发送中,请稍后..."); 	
		var jsonurl=jsonserver+"bl/randomPwd/"+objlogin_name;        
		$.getJSON(jsonurl+".jsonp?callback=?",
			{}, 
			function(data) {
				if(data.sb.status=="00000"){
					$("#warning").html("密码已经发送，请在60分钟内登陆！"); 
					$("#sendbtn1").hide();
					$("#sendbtn2").show();
					$("#sendbtn2").html("<span id='timespan' style='color:red;'>"+reSendTime+"</span>秒后重新获取");
					//alert(reSendTime);
					var reTime=setInterval(function(){
						reSendTime--;
						$("#sendbtn2").html("<span id='timespan' style='color:red;'>"+reSendTime+"</span>秒后重新获取");
						if(reSendTime<1){
							clearInterval(reTime);
							$("#sendbtn1").show();
							$("#sendbtn2").hide();
						}
							
					},1000);
					
				}else{
					$("#warning").text(data.sb.statusDesc);
					return false;
				}
			});
	}

}

		
    

//}
</script>
<style type="text/css" media="all">
body {
	background-color:#F3F3F3
	}
.floatBoxBg{
	width:100%;
	height:300%;
	background:#181e2a;
	filter:alpha(opacity=50);
	opacity:0.5;
	position:absolute;
	top:0;left:0;
	z-index: 999;
	}
#wrapper {
	width: 100%;
	float: left;
	position: relative;	/* On older OS versions "position" and "z-index" must be defined, */
	z-index: 1;			/* it seems that recent webkit is less picky and works anyway. */
	overflow: hidden;
}

#scroller {
	width: 300%;
	height: 100%;
	float: left;
	padding: 0;
}


.carousel_paging2_selected {
	border-radius: 5px;
	text-align:center;
	background:#666;
	width: 5px;
	height: 5px;
	float: left;
	
}
    

#scroller ul {
	list-style:none;
	display:block;
	float:left;
	width:100%;
	height:100%;
	padding:0;
	margin:0;
	text-align:left;
}


#scroller li {
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	-o-box-sizing: border-box;
	box-sizing: border-box;
	display: block;
	float: left;
	width: 33.33%;
	padding-left:2px;
	text-align: center;
	font-family: georgia;
	font-size: 24px;
	line-height: 140%;
	color: #f22900;
}

#nav {
	width: 100%;
	float: left;
}

#prev, #next {
	float: left;
	font-weight: bold;
	font-size: 14px;
	padding: 3px 0;
	width: 43.5%;
}

#next {
	float:right;
	text-align:right;
}

#indicator, #indicator > li {
	display:block; float:left;
	list-style:none;
	padding:0; margin:0;
}

#indicator {
	width: 36px;
	height:50px
	padding-top: 10px;
	padding-right: 10px;
	padding-bottom: 0px;
	padding-left: 10px;
	padding-top: 10px;
}

#indicator > li {
	text-indent:-9999em;
	width:8px; height:8px;
	-webkit-border-radius:4px;
	-moz-border-radius:4px;
	-o-border-radius:4px;
	border-radius:4px;
	background:#ddd;
	overflow:hidden;
	margin-right:4px;
	background-image:url(resources/css/images/dian.jpg)
}

#indicator > li.active {
	background-image:url(resources/css/images/dian_on.png)
}

#indicator > li:last-child {
	margin:0;
}
#content {
	height:1150px;
	}
.floatBoxBg{
	width:100%;
	height:300%;
	background:#181e2a;
	filter:alpha(opacity=50);
	opacity:0.5;
	position:absolute;
	top:0;left:0;
	z-index: 999;
	text-align:center;
	vertical-align:central;
	}
    </style>
<style type="text/css">
</style>
<style type="text/css">
*{
	font-family:Heiti SC;
}
</style>
	<script type="text/javascript">
//var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
//document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F2284c04845acdcd94dd640a8555927dc' type='text/javascript'%3E%3C/script%3E"));
</script>
</head>

<body style="margin:0; background-image:url(bi/res/img/bg.png)">

	<div style="text-align:center; margin-top:80px;"><img style="width:54.4%" src="bi/res/img/denglu---3_03.png"/></div>
    <div id="content">
    <!--<div id="loading" class="loading"><img src="resources/css/images/loading.gif"/>载入中...</div>
    <div class="floatBoxBg"></div>-->

<div id="blank1" style="width:100%; height:0px; text-align:center"><img style="margin-top:25px;" src="bi/res/img/wenzi.png"/></div>
<div style="width:100%;" align="center">

  <div style="width:100%; height:62px; line-height:62px"><span style="font-size:32px; color:#fff; text-shadow:#579df1 1px 1px 1px ">手机号: </span><input type="tel" placeholder="" style=" border-radius:15px; width:60%; height:62px; font-size:30px" id="phoneNo" onkeyup="value=value.replace(/[^\d]/g,'')" /></div>
  <div style="width:100%; height:94px; line-height:94px; margin-top:31px"><span style="font-size:32px; color:#fff; text-shadow:#579df1 1px 1px 1px ">验证码: </span><input type="password" placeholder="" style=" border-radius:15px; height:62px; font-size:30px; width:60%;" id="password"/></div>
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <td colspan="4" style="color:red; font-size:32px;" align="center"><span id="warning"></span></td>
  <tr>

    <td height="94px" width="11%">&nbsp;</td>

    <td width="39%"><div style="height:58px; width:95%; background-image:url(bi/res/img/loginpng.png); border-radius:15px; color:#244770; font-size:28px; line-height:58px; text-align:center; box-shadow:#000 1px 1px 1px" onclick="login1()">登录</div></td>
    <td width="39%" align="right">
	<div id="sendbtn1" style="height:58px; width:95%; background-image:url(bi/res/img/sendpwdpng.png); border-radius:15px; color:#244770; font-size:28px; line-height:58px; text-align:center; box-shadow:#000 1px 1px 1px" onClick="getpasscode()">获取验证码</div>
    <div id="sendbtn2" style=" display:none; height:58px; width:95%; background-image:url(bi/res/img/billdet/getPwd_back.png); border-radius:15px; color:#FFF; font-size:28px; line-height:58px; text-align:center"></div>

    </td>
    <td width="11%">&nbsp;</td>

    
    
  </tr>
  <tr height="20">
  	
  </tr>
 
</table>
<div style="font-size:30px; color:#ffffff; text-align:center"><a style="font-size:30px; color:#ffffff;" href="http://bj.wo.com.cn/smart/page/">点击进入掌沃北京</a></div>
    </div>
	</div>
<div id="footer">
</div>
    
</body>
</html>
